Skip to main content

Full text of "The Programmer Owner's Guide"

See other formats


A 

ATARI® 



A Warner Communications Company 


O 



W elcome to the incredible world of ATARI® Computer 
programming! In just a few minutes, you'll have your 
new ATARI 400™ Computer up and running. 

First, well go through the installation process (Steps 1 through 3). 
Then, starting with Step 4, we'll show some examples of programming. 

The ATARI 400 Computer is programmed in a language called 
ATARI BASIC. This programming language is very similar to the 
BASIC languages found on much larger computers, but it has addi- 
tional graphics, color and audio capabilities. 

You’ll be amazed at how powerful a simple ATARI BASIC program 
can be. 


INSTALLATION 


PROGRAMMING 
IN ATARI BASIC 



1 Unpack all of your equipment 
and read The Basic Computer ™ 
Owner's Guide. Follow the 
ten steps for installing the TV 
Switch Box and connecting the 
computer console. Make sure the 
TV Switch Box is set to Game or 
Computer, that the TV is tuned to 
channel 2 or 3 and that the channel 
select switch on the computer is set 
to the same channel. 



3 Insert the ATARI BASIC 

Computing Language car- 
tridge into the computer, 
with the label facing you. 
Press down firmly on the cartridge 
until it snaps into place. Then, close 
the cartridge door. Be sure the door 
snaps shut. 


You're ready to begin programming 
now, and you won’t have to repeat 
these installation steps. From now 
on, you can start up again at step 4. 


READY 


4 Turn on the power to your 
TV and to the computer. 
The screen will display 
the word READY This 
means that the computer is ready 
for you to enter a program. 


5 


Your ATARI 400 Computer 
has two ways or modes in 
which programs can be 
entered. 


Direct Mode, in which single 
lines are entered and imme- 
diately executed. This mode 
is good for doing single-line 
calculations and for experi- 
menting with other single 
program statements. 


• Deferred Mode, in which mul- 
tiple lines can be entered 
and are executed later, when 
you type in the "RUN" com- 
mand. This mode is used in 
the great majority of cases. 


Push the door release 
lever down to raise the 
cartridge door. 







You don't have to tell the computer 
which mode to use; it knows by the 
way you type in your lines. We’ll 
run through a few examples of each 
mode, and explain a few funda- 
mentals about the keyboard and 
screen display as we go. 

In the following photographs, your 
entries are colored red so you can 
distinguish what you should type 
from the information the computer 
responds with. 

6 In the Direct Mode, single 
lines called “commands" or 
"statements” are entered, 
and the computer exe- 
cutes them immediately. For exam- 
ple, try typing the following line and 
pressing the ™=wi=i« key; be sure 
that the spacing between characters 
(or the lack of spacing) is exactly 
as shown here: 

PRINT 5+4 

This is what you should see on your 
TV screen: 



7 If you make a mistake 
in typing, press the 
i.ldlVlJitMia key to back- 
space. To clea r the screen 
and start over, press the S5EEI2S3 
key. Try using these two keys when 
you do Step 8. 


8 


The symbols used for cal- 
culating are: 

Addition + 

Subtraction — 

Multiplication * 

Division / 


Complicated calculations use par- 
entheses to separate the parts of the 
expression. The reference books 
mentioned later describe all the 
rules for expressing calculations, 
but try typing the following state- 
ment and pressing the mai'iaJb key: 

PRINT (5+4)*(6-2) 

Now, try: 

PRINT ((5+4)*(6— 2))/3 

Here’s what you should see on your 
TV screen (your entries are shown 
in red): 


r 


READY 


36 


READY 


12 


READY 

■ 

L 

J 


9 There’s another way to 

use the PRINT command. 
When quotation marks 
are placed around the 
characters to be printed, those char- 
acters (called a "string” of charac- 
ters) are printed literally, rather 
than being evaluated arithmetically. 

For example, type this command 
and press the G3Q3S9 key: 

PRINT "5+4” 

Here's what you should see: 










PROGRAMMING 
IN ATARI BASICcont 


W Ycur computer can 
generate an incred- 
ible range of sounds 
through the speaker 
on your TV set. For example, try 
entering the following three state- 
ments, ending each one with the 


RETURN 


SOUND 0,200,10,10 
SOUND 1,100,10,10 
SOUND 2,50,10,10 

The first number in these state- 
ments is the sound channel: up to 
four channels, each playing a differ- 
ent sound, can be used. The second 
number is the tone or note. The 
other numbers are explained in the 
ATARI BASIC Self-Teaching Guide 
and the ATARI BASIC Reference 
Manual. 


In the screen below, we have 
pressed the ESE2E1SI1 key before 
entering the three statements. Be 
sure to turn up the volume on your 
TV set to hear the sounds. 




SYSTEM RESET 


Press the I 
key to stop the sounds. 


I Now, let's move on to 

^B ^^^B the Deferred Mode of 
programming which 
B MB we mentioned in Step 
5. In this mode, each line has a line 
number, and multiple lines com- 
prising an entire program can be 
entered. The computer executes 
the program when you enter the 
RUN command. 


For example, try typing the follow- 
ing lines, ending each one with the 
JaamsHM key. Again, be careful that 
the spacing between characters (or 
the lack of spacing) is exactly as 
shown: 


10 A=5+4 
20 B=6— 2 
30 C=A*B 
40 PRINT C 
RUN 


Here's what you should see on your 
TV screen: 



You can change lines you have 
already entered by simply retyping 
the line number with new informa- 
tion after the line number. 

For example, if your see one of your 
lines displayed with the word 
"ERROR" in front of it, simply retype 
the line correctly, using the same 
line number. 

Individual line numbers can be 
erased from the computer's mem- 
ory by typing the line number and 
immediately pressing the 
key. 



n You can be sure that 
a program is in the 
computer's memory 
by typing the word 
LIST and pressing the key. 



M To clear the com- 
puter's memory in 
preparation for enter- 
ing a new program, 
type the word NEW and press the 
ESZS3ZB key- Then, type the word 
LIST again to verify that the memory 
has actually been cleared: when the 
memory is empty, nothing will be 
listed. 


RETURN 












B Another way to clear 
the computer's mem- 
ory is to turn the com- 
puter's power switch 
off, then on again. Pressing the 
KjttaiakililxSl key simply clears the 
screen, not the memory. 


Because turning the power off 
clears the memory, you may want a 
storage device, such as a tape 
recorder, for storing and retrieving 
programs. These are described in 
the next section. 



16 


Now, let’s try some 
fun programs. The 
first one is an Atari 
Rocket. 


This program shoots a rocket 
across your TV screen, from column 
0 (the left-most side) to column 32 
(near the right side). At the same 
time, there is a blast of sound whose 
pitch increases and whose volume 
decreases as the rocket moves 
across the columns. The rocket is 
positioned in row 10, which is 10 
lines down from the top of your 
TV screen. 


To enter the program, press the 
KaxmuiisaH key to clear your 
screen. Then, type in the following 
lines: 


10 FOR COLUMN =0 to 32 
20 SOUND 0,COLUMN*5,8, 
COLUMN/2 

30 POSITION COLUMN, 10 
40 PRINT "*>ATARI>" 

50 NEXT COLUMN 

Press the ^JESEHSl key again to 
clear the screen. Make sure the vol- 
ume on your TV is turned up. Then, 
type in the RUN command and 
press the IsMihHI key. Here's what 
you should see: 


I READY 


************************* > A T A R I > 

READY 

■ 

L 

j 


V Here's another fun 
program. This one 
B simulates a Locomo- 
tive. The locomotive 
chugs 190 miles across your TV 
screen and blows its whistle as it 
approaches the station, 175 miles 
away! The chugging sound is made 
with a varying loudness, where the 
loudness decreases from maximum 
to minimum in each mile that the 
locomotive moves. 


To enter the program, press the 
IS323922S31 key to clear your 
screen. Then, type in the following 
lines: 

NEW 

10 FOR MILE= 1 TO 190 
20 FOR LOUDNESS= 15 TO 0 
STEP -1 

30 SOUND 0,15,0, LOUDNESS 
40 NEXT LOUDNESS 
50 PRINT 

60 IF MILE=175 THEN SOUND 

1,50,10,15 

70 NEXT MILE 

Press the key again to 

clear the screen. Make sure the 
volume on your TV is turned up. 
Then, type in the RUN command 
and press the key. Here's 

what you should see: 


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 










PROGRAMMING 
IN ATARI BASIC coni 


W This program is a 
Lightning Bolt. It 
starts out by switch- 
ing to a graphics dis- 
play mode (as opposed to the 
normal text display mode). Then, it 
selects a starting color and plots 
(draws) a lightning bolt from col- 
umn 10, row 0 to column 20, row 19 
on your screen. Simultaneously, a 
sound with a varying pitch is gen- 
erated. The lightning bolt blinks ten 
times through various colors. Time 
delays are built into the blinking so 
that you can see the colors longer. 


To enter the program, press the 
^B3S3S3 key to clear your 
screen. Then, type in the following 
lines: 


NEW 

10 GRAPHICS 3 
15 COLOR 1 
20 PLOT 10,0 
25 DRAWTO 20,19 
30 FOR PITCH =1 TO 255 
35 SOUND 0, PITCH, 8, 15 
40 NEXT PITCH 
45 FOR BLINK=1 TO 10 
50 SETCOLOR 0, BLINK, 8 
55 FOR DELAY=1 TO 100 
60 NEXT DELAY 
65 SETCOLOR 0,9,14 
70 FOR DELAY = 1 TO 100 
75 NEXT DELAY 
80 NEXT BLINK 


Press the ESHEZEISI key again to 
clear the screen. Make sure the 
volume on your TV is turned up. 
Then, type in the RUN command 
and press the ■swmsim key. Here’s 
what you should see: 



Press the BSliZIaSS key again 
to clear the screen and enter the 
RUN command. Then, answer the 
questions that the program asks you. 
Here’s the kind of thing you should 
see: 


r 

READY 

RUN 

CURRENT BALANCE 7506.43 

CHECK OR DEPOSIT? — 55 . 42 

NEM BALANCE IS: 445.01 
CHECK OR DEPOSIT? 100 . 98 

NEM BALANCE IS: 545.99 
CHECK OR DEPOSIT?— 45 . 00 

NEM BALANCE IS: 500.99 

LT~' 


W This final example is 
a Checkbook Balanc- 
ing program. It starts 
out by asking your 
current balance. After you type this 
in and press the il:ia ‘ ll!l ™ key, it re- 
peatedly asks for check or deposit 
transactions, and then computes 
the new balance. Checks written 
against your account should be 
entered as negative numbers, while 
deposits made to your account 
should be entered as positive 
numbers. 


To enter the program, press the 
key to clear your 

screen. Then, type in the following 
lines: 


NEW 

10 PRINT "CURRENT 
BALANCE ’’; 

20 INPUT BALANCE 
30 PRINT ” 

40 PRINT "CHECK OR 
DEPOSIT"; 

50 INPUT TRANSACTION 
60 PRINT " 

70 BALANCE= BALANCE + 
TRANSACTION 
80 PRINT "NEW BALANCE 
IS: ’’; BALANCE 
90 GO TO 40 


SYSTEM RESET 


Press the or 
key to stop the Checkbook Bal- 
ancing program. 



Now, try your 
own hand at 
programming. If 
you’re new at it, 


start by reading the ATARI BASIC 
Self-Teaching Guide (Wiley, 1979). 
This book takes you slowly and 
simply through each type of state- 


ment and command. 


If you’ve had some experience at 
programming, you might want to 
start with the ATARI BASIC Refer- 
ence Manual. This manual has an 
alphabetized list of statements and 
commands on page A-l (Appendix 
A), a list of error messages on page 
B-l (Appendix B) and a helpful 
index at the end. 


Your imagination is the limit. You 
can create a wealth of fascinating 
and useful programs for budget 
projections, colorful graphic dis- 
plays, musical games, or quizzes 
that ask questions and respond in 
all sorts of ways. 











STORAGE DEVICES WHERE TO GO 

AND PRINTERS FROM HERE 


A s you write more and 

more programs, you may 
want to store them for 
later retrieval and reuse. 
This will save you from typing the 
programs in again each time you 
want to run them. You may also want 
printed copies of your programs. 

Here's a list of storage devices and 
printers that will expand your enjoy- 
ment of the ATARI 400 Computer. 
Check the ATARI Personal Com- 
puter Product Catalog for more 
details, or get a demonstration at 
your local ATARI Computer dealer. 


ATARI 410™ Program Recorder — 

This inexpensive tape recorder can 
store approximately 100,000 char- 
acters (bytes) of information on a 
standard 60-minute cassette tape. 


ATARI 820™ Printer— This 40- 
column printer prints text on stand- 
ard 3%" paper available from most 
stationery stores. Its printing speed 
is 40 characters per second. 


ATARI 822™ Printer— This 40- 
column thermal printer prints text 
and plots points on thermal paper 
available from your ATARI Com- 
puter dealer. Its printing speed is 
37 characters per second. 


ATARI 825™ Printer— This 80- 
column printer prints text in four 
ways (including elongated, con- 
densed and proportionally spaced) 
on three kinds of standard paper 
(roll, fan-fold and single sheets). Its 
printing speed varies between 50 
and 83 characters per second, 
depending on the character font 
used. It also underlines. You will 
also need an ATARI 850™ Interface 
Module to use this printer. 


f you have an ATARI 410 Pro- 
gram Recorder, you'll find the 
following cassette programs 
especially useful in learning 
how to write your own programs 
in ATARI BASIC. The ATARI 410 
Program Recorder comes in The 
Educator™ Kit or it can be pur- 
chased separately. The cassette 
programs are sold separately. 

An Invitation to Programming™ 1 
An Invitation to Programming 2* 

An Invitation to Programming 3* 

And this is just the beginning of the 
many exciting ways you can put 
your ATARI 400 Computer to work 
for you. Dozens of programs are 
available to help you in your busi- 
ness and education, or simply to 
enjoy. The following kits make it 
easy for you to expand your system 
so it can do more. 

If you'd like to add to your system 
even more, the ATARI Personal 
Computer Product Catalog, avail- 
able from your local ATARI Com- 
puter dealer, explains how many 
other ATARI products can enhance 
your computer. 




* Available soon. 


THE ENTERTAINER 


MORE SPECIALLY PRICED 
KITS FOR THE 
BASIC COMPUTER 


5 


Insert the Star Raiders™ cartridge and become 
a Starship Commander! Arm your attack com- 
puter, jump through hyperspace and battle the 
attacking Zylon fighters! 

The Entertainer kit comes with a pair of joy- 
stick controllers and two of the world's most 
exciting computer games — Star Raiders and 
Missile Command™ Tb play Star Raiders, all 
you do is insert the cartridge, plug in a joystick 
and get ready for high-speed combat. 

Many other exciting computer games for your 
ATARI Computer are available now or will be 
available soon. 

Asteroids™ 

Space Invaders 1 
Super Breakout* 

3-D Tic-Tac-Tbe 
Video Easel™ 

Basketball 
Computer Chess 





Let the computer teach you a variety of 
subjects and skills. It can help you and your 
children learn faster because The Educator 
kit makes learning fun. 

The Educator comes with an ATARI 410™ 
Program Recorder to load your programs, an 
ATARI BASIC cartridge and the States & 
Capitals program cassette. All you do is insert 
the cartridge, plug in the Program Recorder 
and load the program — the computer takes it 
from there. 

Many other educational and self-improvement 
programs and games for your ATARI Computer 
are available now or will be available soon: 

Energy Czar™ 

Hangman 

Conversational Spanish 
Conversational French 
Conversational German 
Conversational Italian 
European Countries & Capitals 
Tbuch Typing 
Statistics 1 

An Invitation to Programming™ 1 
An Invitation to Programming 2 
An Invitation to Programming 3 
Kingdom™ 

Scram™ (A Nuclear Power Plant Simulation) 

Biorhythm 
Music Composer™ 

Blackjack 

Mortgage & Loan Analysis 2 




The Communicator kit can tap into some of the 
biggest electronic brains in the world! Get the 
news hot off the wire or have The Communi- 
cator print your stock prices right on your TV 
screen. You'll also be able to get electronic 
mail, games and even “talk" to other users. 

The Communicator kit comes with a TteleLonk™ 1 
cartridge, an ATARI 850™ Interface Module 
and an ATARI 830™ Acoustic Modem so you 
can send and receive information over any 
standard telephone. You also receive a free 
hour of connect time to the DOW JONES 
INFORMATION SERVICE, the COMPUSERVE 
INFORMATION SERVICES and THE SOURCE, 
AMERICA'S INFORMATION UTILITY* so you 
can see the many fascinating kinds of informa- 
tion the computer can give you. 




•THE SOURCE and AMERICAS INFORMATION UTILITY are service 
marks of Source Telecomputing Corporation, a subsidiary of the Reader’s 
Digest Association. Inc.